package net.ojbk.study.curriculumDesign.service.impl.canvasmodel;

import net.ojbk.study.curriculumDesign.beans.canvasmodel.Message;
import net.ojbk.study.curriculumDesign.dao.canvasmodel.MessageDao;
import net.ojbk.study.curriculumDesign.service.canvasmodel.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("messageService")
public class MessageServiceImpl implements IMessageService {
    @Autowired
    @Qualifier("messageDao")
    private MessageDao messageDao;

    /* 方法用途对应接口中注释*/
    @Override
    public List<Message> getmsgByuid(int uid) {
        return messageDao.selectByuid(uid);
    }

    @Override
    public List<Message> getmsgBycid(int cid) {
        return messageDao.selectBycid(cid);
    }

    @Override
    public void addMessage(Message message) {
        messageDao.insertOne(message);
        return;
    }

    @Override
    public void deleteMessage(int mid) {
        messageDao.deleteOne(mid);
    }

    @Override
    public Integer getCount() {
        return messageDao.selectCount();
    }
}
